
#include "Animator.h"
#include "WalkRight.h"

WalkRight* WalkRight::_walkRight = NULL;


WalkRight::WalkRight()
{
	speed = 0.1f;
	direction = XMFLOAT2();
	direction.x = 1;
	direction.y = 0;
	name = "walk_right";
}

void WalkRight::Enter(GameSprite* sprite)
{
	State::Enter(sprite);
	speed = ((Actor*)sprite)->getSpeed();
}

void WalkRight::Do(double time)
{
	XMFLOAT2 pos = sprite->getPosition();

	pos.x += direction.x * speed;
	pos.y += direction.y * speed;

	sprite->setPosition(pos);

	Animator::Instance()->Animate((Actor*)sprite, animation, time);
}

void WalkRight::Exit()
{
	_walkRight = NULL;
	return;
}

